package com.fancy.mobileschool.ui.adapt;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.fancy.mobileschool.R;

import java.util.List;




/**
 * Created by l on 2017/10/10.
 */

public class StringAdapter extends BaseAdapter {

    private List<String> list;
    private Context context;

    public StringAdapter(List<String> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView= LayoutInflater.from(context).inflate(R.layout.list_item_hdunews,parent,false);
        TextView textView=(TextView)convertView.findViewById(R.id.list_item_hdunews_title);
        textView.setText(list.get(position));
        return convertView;
    }
}
